Условие:Вам даны две матрицы, нужно написать функцию для их умножения. Матрицы могут быть квадратными или прямоугольными.
Решение: Напишем решение на чистом Python
def matrix_multiply(A, B): # Сначала проверим, можем ли мы вообще перемножить эти матрицы if len(A[0]) != len(B): raise ValueError("Number of A columns must equal number of B rows.")
# Инициализируем результирующую матрицу, заполненную нулями result = [[0 for _ in range(len(B[0]))] for _ in range(len(A))]
# Перемножим матрицы for i in range(len(A)): for j in range(len(B[0])): for k in range(len(B)): result[i][j] += A[i][k] * B[k][j]
return result
# Проверим функцию на примере A = [[1, 2, 3], [4, 5, 6]]
B = [[7, 8], [9, 10], [11, 12]]
result = matrix_multiply(A, B) for row in result: print(row)
Условие:Вам даны две матрицы, нужно написать функцию для их умножения. Матрицы могут быть квадратными или прямоугольными.
Решение: Напишем решение на чистом Python
def matrix_multiply(A, B): # Сначала проверим, можем ли мы вообще перемножить эти матрицы if len(A[0]) != len(B): raise ValueError("Number of A columns must equal number of B rows.")
# Инициализируем результирующую матрицу, заполненную нулями result = [[0 for _ in range(len(B[0]))] for _ in range(len(A))]
# Перемножим матрицы for i in range(len(A)): for j in range(len(B[0])): for k in range(len(B)): result[i][j] += A[i][k] * B[k][j]
return result
# Проверим функцию на примере A = [[1, 2, 3], [4, 5, 6]]
B = [[7, 8], [9, 10], [11, 12]]
result = matrix_multiply(A, B) for row in result: print(row)
#программирование #линейная_алгебра
BY Библиотека собеса по Data Science | вопросы с собеседований
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Most people buy Bitcoin via exchanges, such as Coinbase. Exchanges allow you to buy, sell and hold cryptocurrency, and setting up an account is similar to opening a brokerage account—you’ll need to verify your identity and provide some kind of funding source, such as a bank account or debit card. Major exchanges include Coinbase, Kraken, and Gemini. You can also buy Bitcoin at a broker like Robinhood. Regardless of where you buy your Bitcoin, you’ll need a digital wallet in which to store it. This might be what’s called a hot wallet or a cold wallet. A hot wallet (also called an online wallet) is stored by an exchange or a provider in the cloud. Providers of online wallets include Exodus, Electrum and Mycelium. A cold wallet (or mobile wallet) is an offline device used to store Bitcoin and is not connected to the Internet. Some mobile wallet options include Trezor and Ledger.
How Does Telegram Make Money?
Telegram is a free app and runs on donations. According to a blog on the telegram: We believe in fast and secure messaging that is also 100% free. Pavel Durov, who shares our vision, supplied Telegram with a generous donation, so we have quite enough money for the time being. If Telegram runs out, we will introduce non-essential paid options to support the infrastructure and finance developer salaries. But making profits will never be an end-goal for Telegram.
Библиотека собеса по Data Science | вопросы с собеседований from de